<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: Mutexes</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__sys__mutex.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Mutexes<div class="ingroups"><a class="el" href="group__lwip.html">lwIP</a> &raquo; <a class="el" href="group__sys__layer.html">Porting (system abstraction layer)</a> &raquo; <a class="el" href="group__sys__os.html">OS abstraction layer</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga38e7dae1fd88b338eb1cd97f110f3897"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#ga38e7dae1fd88b338eb1cd97f110f3897">sys_mutex_new</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:ga38e7dae1fd88b338eb1cd97f110f3897"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4d4eb9afe5965fa2661dd54ff55d616a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#ga4d4eb9afe5965fa2661dd54ff55d616a">sys_mutex_lock</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:ga4d4eb9afe5965fa2661dd54ff55d616a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5568f68898fe9d5735f9ce2f665624fb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#ga5568f68898fe9d5735f9ce2f665624fb">sys_mutex_unlock</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:ga5568f68898fe9d5735f9ce2f665624fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga16336ce68b741e98204102ca4bc84dd9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#ga16336ce68b741e98204102ca4bc84dd9">sys_mutex_free</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:ga16336ce68b741e98204102ca4bc84dd9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaebe83ba90a6d9c23cdb3eb5d49562c4a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#gaebe83ba90a6d9c23cdb3eb5d49562c4a">sys_mutex_valid</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:gaebe83ba90a6d9c23cdb3eb5d49562c4a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3f392725971dc837aa56dd7e45fa7ca8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sys__mutex.html#ga3f392725971dc837aa56dd7e45fa7ca8">sys_mutex_set_invalid</a> (sys_mutex_t *mutex)</td></tr>
<tr class="separator:ga3f392725971dc837aa56dd7e45fa7ca8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Mutexes are recommended to correctly handle priority inversion, especially if you use LWIP_CORE_LOCKING . </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga16336ce68b741e98204102ca4bc84dd9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga16336ce68b741e98204102ca4bc84dd9">&#9670;&nbsp;</a></span>sys_mutex_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_mutex_free </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Deallocates a mutex. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>the mutex to delete </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga4d4eb9afe5965fa2661dd54ff55d616a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4d4eb9afe5965fa2661dd54ff55d616a">&#9670;&nbsp;</a></span>sys_mutex_lock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_mutex_lock </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Blocks the thread until the mutex can be grabbed. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>the mutex to lock </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga38e7dae1fd88b338eb1cd97f110f3897"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga38e7dae1fd88b338eb1cd97f110f3897">&#9670;&nbsp;</a></span>sys_mutex_new()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> sys_mutex_new </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a new mutex. Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. The mutex is allocated to the memory that 'mutex' points to (which can be both a pointer or the actual OS structure). If the mutex has been created, ERR_OK should be returned. Returning any other error will provide a hint what went wrong, but except for assertions, no real error handling is implemented.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>pointer to the mutex to create </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK if successful, another err_t otherwise </dd></dl>

</div>
</div>
<a id="ga3f392725971dc837aa56dd7e45fa7ca8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3f392725971dc837aa56dd7e45fa7ca8">&#9670;&nbsp;</a></span>sys_mutex_set_invalid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_mutex_set_invalid </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Invalidate a mutex so that <a class="el" href="group__sys__mutex.html#gaebe83ba90a6d9c23cdb3eb5d49562c4a">sys_mutex_valid()</a> returns 0. ATTENTION: This does NOT mean that the mutex shall be deallocated: <a class="el" href="group__sys__mutex.html#ga16336ce68b741e98204102ca4bc84dd9">sys_mutex_free()</a> is always called before calling this function! This may also be a define, in which case the function is not prototyped. </p>

</div>
</div>
<a id="ga5568f68898fe9d5735f9ce2f665624fb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5568f68898fe9d5735f9ce2f665624fb">&#9670;&nbsp;</a></span>sys_mutex_unlock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_mutex_unlock </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Releases the mutex previously locked through '<a class="el" href="group__sys__mutex.html#ga4d4eb9afe5965fa2661dd54ff55d616a">sys_mutex_lock()</a>'. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>the mutex to unlock </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaebe83ba90a6d9c23cdb3eb5d49562c4a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaebe83ba90a6d9c23cdb3eb5d49562c4a">&#9670;&nbsp;</a></span>sys_mutex_valid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int sys_mutex_valid </td>
          <td>(</td>
          <td class="paramtype">sys_mutex_t *&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns 1 if the mutes is valid, 0 if it is not valid. When using pointers, a simple way is to check the pointer for != NULL. When directly using OS structures, implementing this may be more complex. This may also be a define, in which case the function is not prototyped. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
